package com.reef.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.reef.dto.bbviewDto;
import com.reef.entity.Bookborrew_view;
import com.reef.service.BookborrewviewService;
@RestController
public class BookborrewviewController {
	@Autowired
private BookborrewviewService bbvService;
	@RequestMapping("/findByBbdto")
	public Object findByBbdto(bbviewDto bbDto,int page,int limit) {
		PageRequest pageable = PageRequest.of(page-1, limit);
		Page<Bookborrew_view> pagelimit = bbvService.findByCondition(bbDto, pageable);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("code", 0);
		map.put("msg", "");
		map.put("count", pagelimit.getTotalElements());
		map.put("data", pagelimit.getContent());
		return map;
		
	}
	/**
	 * 查询类别
	 */
	@RequestMapping("/selClassName")
	public Object selClassName() {
		return bbvService.selClassName();
	}
}
